A data processor can often run an operating system that allows the processor to “simultaneously” run multiple application programs, i.e., applications. For example, an Intel Pentium® processor can run a Microsoft Windows® operating system, which allows the processor to simultaneously run applications such as MS Word® (word processor), Netscape Navigator® (web browser), and Adobe Acrobat® (image reader). Specifically, because the processor can typically execute the code of only one application at a time—in this sense, “simultaneous” is a misnomer—the operating system controls the processor such that the processor executes the code of one application for a first time period, the code of another application for a second time period, and so on, and then repeats this sequence. Because the time periods are relatively small (typically on the order of milliseconds (ms)), it appears to a user that the processor is running more than one application at the same time, hence the term “simultaneous.” The processor's execution of the code of one application and then the code of another application is often called context switching because the processor, under the control of the operating system, switches from running the one application to running the other application. Furthermore, the processor may facilitate context switching by the operating system. For example, the instruction set of the processor may include specialized context-switching instructions that the operating system can use to, e.g., save the data generated by one application before switching to the other application. Furthermore, the processor may include circuitry for handling interrupts that initiate a switch from one application to the other.
Similarly, in a data-processing circuit that includes multiple data processors, each processor can run a respective operating system that allows the processor or a group of cooperating processors to “simultaneously” run multiple applications in the above-described manner. Such a data-processing circuit is further described below in conjunction with FIG. 1.
Unfortunately, because a data processor typically cannot run multiple applications “simultaneously” without also running an operating system, a processor that operates in a stand-alone mode, i.e., without running an operating system, typically cannot run multiple applications “simultaneously”.
FIG. 1 is a block diagram of a conventional data-processing circuit 10, which includes two processors 12 and 14 that run their own operating systems so that together they can run multiple applications “simultaneously”. In addition to the cooperating processors 12 and 14, the circuit 10 includes memories 16 and 18. The memory 16 includes a section 22 and sections 241–24n for respectively storing the code of the operating system and the code of the applications or portions of the applications run by the processor 12. The memory 16 also includes a section 26 for storing data generated by the processor 12 while it executes the operating-system and/or application code. Similarly, the memory 18 includes a section 28 and sections 301–30n for respectively storing the code of the operating system and the code of the applications or portions of the applications run by the processor 14, and a section 32 for storing data generated by the processor 14.
In operation, the processors 12 and 14 cooperate to “simultaneously” run multiple applications programs, and are under the control of the operating systems stored in the memory sections 22 and 28, respectively, during all of the time periods discussed below.
During a first application-running period, the processor 12 executes a portion of the first-application code stored in the memory section 241 and the processor 14 executes a portion of the first-application code stored in the memory section 301. Although the processors 12 and 14 may execute the same portion of the first-application code, they typically cooperate more effectively by executing different portions of the code. For example, if the first application is an image-encoding program, then the processor 12 might execute a portion of the code that encodes image data and the processor 14 might execute a portion of the code that generates an encoded bit stream from the encoded image data. Consequently, to use memory efficiently when the processors 12 and 14 execute different portions of an application's code, the memory section 241 may store only the portion of the code that is executed by the processor 12, and the memory section 301 may store only the portion of the code that is executed by the processor 14. The processor 12 stores in the memory section 26 any data that it generates while executing its portion of the first-application code; likewise, the processor 14 stores in the memory section 32 any data that it generates while executing its portion of the first-application code.
During a context-switching period, the processors 12 and 14 prepare to switch from executing the respective portions of the first-application code stored in the memory sections 241 and 301 to executing respective portions of the second-application code stored in the memory sections 242 and 302. One or both of the operating systems respectively being run by the processors 12 and 14 initiate the context-switching period on its/their own or in response to a signal, such as an interrupt request, that one or both of the processors process. As a result of this initiation, the processor 12 performs one or more context-switching tasks such as loading its program counter (not shown) with a value that points to the memory section 242. Also, if during subsequent time periods the processor 12 might overwrite the data it stored in the memory section 26 during the first application-running period, the processor saves this data to another memory location where it will not be overwritten. In addition, the processor 12 may restore to the memory section 26 data that it generated and saved during a prior execution of the application code—here the second-application code—that it is preparing to execute. Likewise, the processor 14 performs one or more such context-switching tasks such as loading its program counter (not shown) with a value that points to the memory section 302, saving data from the memory section 32 to another memory location, and restoring previously saved data to the memory section 32. The context-switching period typically ends once the processors 12 and 14 have finished executing their context-switching tasks.
During a second application-running period, the processor 12 executes a portion of the second-application code stored in the memory section 242 and the processor 14 executes a portion of the second-application code stored in the memory section 302. As discussed above, although the processors 12 and 14 may execute the same portion of the second-application code, they typically cooperate more effectively by executing different portions of the code. For example, if the second application is an image-decoding program, then the processor 12 might execute a portion of the code that decodes image data and the processor 14 might execute a portion of the code that parses the received encoded bit stream. Consequently, to use memory efficiently, the memory section 242 may store only the portion of the second-application code that is executed by the processor 12, and the memory section 302 may store only the portion of the second-application code that is executed by the processor 14. The processor 12 stores in the memory section 26 any data that it generates while executing its portion of the second-application code; likewise, the processor 14 stores in the memory section 32 any data that it generates while executing its portion of the second-application code.
The processors 12 and 14 continue switching back and forth between the first and second applications (and any other applications that the processors 12 and 14 are simultaneously running) until instructed to stop. Furthermore, although not discussed, the processors 12 and 14 typically execute respective portions of the operating-system code during operating-system-running periods that occur between the application-running and context-switching periods discussed above.
Still referring to FIG. 1, the processors 12 and 14 typically incur relatively large levels of overhead to run the respective operating systems. Specifically, running an operating system typically requires a relatively large percentage of a processor's processing time and a large amount of random-access memory (RAM).
Consequently, to reduce or eliminate this operating-system overhead, it is sometimes desirable to run one or both of the processors 12 and 14 in a stand-alone mode. For example, running the processor 12 in a stand-alone mode often allows it to devote more of its processing time to the applications stored in the memory sections 241–24n and frees up the memory section 22 to store another application or data. This technique is particularly useful if one of the applications is so time intensive that the processor 12 cannot run both the application and the operating system, or if the memory 16 is too small to hold an operating system and multiple applications.
But unfortunately, the processors 12 and 14 typically cannot run multiple applications “simultaneously” without also running respective operating systems and thus incurring the above-described operating-system overhead.